import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)


const routes = [
  {
    path: '/',
    name: 'Main',
    component: () => import( '@/views/Main.vue'),
    redirect:'/login',
    children: [
      // {
      //   path: '/home',
      //   name: 'Home',
      //   component: () => import( '@/views/Home')
      // },
      // {
      //   path: '/user',
      //   name: 'User',
      //   component: () => import( '@/views/User')
      // },
      // {
      //   path: '/mall',
      //   name: 'Mall',
      //   component: () => import( '@/views/Mall')
      // },
      // {
      //   path: '/page1',
      //   name: 'PageOne',
      //   component: () => import( '@/views/other/pageOne.vue')
      // },
      // {
      //   path: '/page2',
      //   name: 'PageTwo',
      //   component: () => import( '@/views/other/pageTwo.vue')
      // },

    ]
  },
  {
    path:'/login',
    name: 'Login',
    component: () => import('@/views/Login/index.vue')
  }

  
  
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
  
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
  const originalPush = VueRouter.prototype.push
  VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)}
